package org.sun.sunshine;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.sun.sunshine.config.EnableSelf;

@SpringBootApplication
@EnableDiscoveryClient
@MapperScan("org.sun.sunshine.hp.dao")
@EnableTransactionManagement
@EnableCaching
@EnableSelf
public class SunshineApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(SunshineApplication.class, args);
        String userName = applicationContext.getEnvironment().getProperty("user.name");
        String userAge = applicationContext.getEnvironment().getProperty("user.age");
        String dinner = applicationContext.getEnvironment().getProperty("dinner");
        //System.err.println("user name :" +userName+"; age: "+ userAge +" dinner:"+dinner);

        System.out.println(applicationContext.getBean("self"));

    }

}
